package com.hon.legionnaire.negocio.vo;

import java.io.Serializable;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

@Entity
@Table(name = "servicoVenda")
@NamedQueries ({
	@NamedQuery(name = "loadAllServicoVenda", query = "from ServicoVendaVO as pc where pc.vendaVO.codigo = :codigo"),
})
public class ServicoVendaVO implements Serializable {

	private static final long serialVersionUID = 1L;

	@EmbeddedId  
	private ServicoVendaPK servicoVendaPK;
	
	@Column(name = "preco_servico")
	Float precoServico;
	
	@JoinColumn(name="cod_venda", 
			referencedColumnName="cod_venda",
			nullable = false,
			insertable=false, updatable=false)
	@ManyToOne(optional=false, fetch= FetchType.LAZY)
	@Basic(optional=false)
	@Fetch(FetchMode.JOIN)
	private VendaVO vendaVO;
	
	@JoinColumn(name="cod_servico", 
			referencedColumnName="cod_servico",
			nullable = false,
			insertable=false, updatable=false)
	@ManyToOne(optional=false, fetch= FetchType.LAZY)
	@Basic(optional=false)
	@Fetch(FetchMode.JOIN)
	private ServicoVO servicoVO;
		
	public ServicoVendaVO(){
		servicoVendaPK = new ServicoVendaPK();
	}
	
	public ServicoVendaPK getServicoVendaPK() {
		return servicoVendaPK;
	}

	public void setServicoVendaPK(ServicoVendaPK servicoVendaPK) {
		this.servicoVendaPK = servicoVendaPK;
	}

	public VendaVO getVendaVO() {
		return vendaVO;
	}

	public void setVendaVO(VendaVO vendaVO) {
		this.vendaVO = vendaVO;
	}

	public ServicoVO getServicoVO() {
		return servicoVO;
	}

	public void setServicoVO(ServicoVO servicoVO) {
		this.servicoVO = servicoVO;
	}

	public Float getPrecoServico() {
		return precoServico;
	}

	public void setPrecoServico(Float precoServico) {
		this.precoServico = precoServico;
	}

}